///
/// AEye, Inc. ("COMPANY") CONFIDENTIAL
/// Unpublished Copyright (c) 2022 AEye, Inc., All Rights Reserved.
///
/// NOTICE: All information contained herein is, and remains the property of COMPANY. The intellectual and technical concepts contained
/// herein are proprietary to COMPANY and may be covered by U.S. and Foreign Patents, patents in process, and are protected by trade secret or copyright law.
/// Dissemination of this information or reproduction of this material is strictly forbidden unless prior written permission is obtained
/// from COMPANY. Access to the source code contained herein is hereby forbidden to anyone except current COMPANY employees, managers or contractors who have executed
/// Confidentiality and Non-disclosure agreements explicitly covering such access.
///
/// The copyright notice above does not evidence any actual or intended publication or disclosure of this source code, which includes
/// information that is confidential and/or proprietary, and is a trade secret, of COMPANY. ANY REPRODUCTION, MODIFICATION, DISTRIBUTION, PUBLIC PERFORMANCE,
/// OR PUBLIC DISPLAY OF OR THROUGH USE OF THIS SOURCE CODE WITHOUT THE EXPRESS WRITTEN CONSENT OF COMPANY IS STRICTLY PROHIBITED, AND IN VIOLATION OF APPLICABLE
/// LAWS AND INTERNATIONAL TREATIES. THE RECEIPT OR POSSESSION OF THIS SOURCE CODE AND/OR RELATED INFORMATION DOES NOT CONVEY OR IMPLY ANY RIGHTS
/// TO REPRODUCE, DISCLOSE OR DISTRIBUTE ITS CONTENTS, OR TO MANUFACTURE, USE, OR SELL ANYTHING THAT IT MAY DESCRIBE, IN WHOLE OR IN PART.
///

#ifndef SENSORLISTENER_HPP
#define SENSORLISTENER_HPP

#include <map>
#include "Listener.hpp"

class SensorListener {
public:
    void addSensor(const std::string& netInterface, const std::string& ipAddress);
    void addSensor(const std::string& netInterface, const std::string& ipAddress, uint16_t commandPort,
            uint16_t rangePort, uint16_t imagePort, uint16_t serverRangePort, uint16_t serverImagePort);
    void connectToSensors();
    void disconnectFromSensors();
    void startSensors();
    void stopSensors();
    void printShotlistNames(const std::string& sensorIp);
    size_t getNumShotlistsOnSensor(const std::string& sensorIp);
    uint16_t numFramesToCapture;

private:
    std::map<std::string, aeye::Listener*> _sensorMap;
    void processRangeDataCallback(aeye::PointCloudFrame&& frame);
    void processDiagnosticDataCallback(aeye::DiagnosticData&& frame);
    void dumpCsv(const aeye::PointCloudFrame& frame);               // example function for SDK, writes csv file
    uint16_t frameIdOfFirstPointCloudFrame;
    bool firstPointCloudFrameEncountered = false;
};

#endif //SENSORLISTENER_HPP
